package com.aspose.cells;

public class LightCell {
   Cell a;
   int b;
   short c;
   int d;
   Object e;
   String f;
   byte g;

   void a(Cell var1) {
      if (this.a != var1) {
         this.a = var1;
         this.d = 6;
         this.e = null;
         this.f = null;
         this.g = -1;
      }

   }

   public int getRowIndex() {
      return this.b;
   }

   public short getColumnIndex() {
      return this.a == null ? this.c : (short)this.a.getColumn();
   }

   public int getValueType() {
      if (this.d == 6 && this.a != null) {
         this.d = this.a.getType();
      }

      return this.d;
   }

   public Object getValue() {
      if (this.e == null && this.a != null) {
         this.e = this.a.getValue();
         if (this.e != null && this.e instanceof DateTime) {
            this.e = ((DateTime)this.e).toDate().getTime();
         }
      }

      return this.e;
   }

   public String getFormula() {
      if (this.f == null && this.a != null && this.a.isFormula()) {
         zyi var1 = this.a.g();
         if (var1.a() != null || var1.b() != null || !var1.e() && !var1.b(this.a.getWorksheet().getCells()) && !var1.a(this.a.getWorksheet().getCells())) {
            this.f = this.a.getFormula();
         }
      }

      return this.f;
   }

   public String getFormulaRange() {
      if (this.a == null) {
         return null;
      } else {
         if (this.a.isFormula()) {
            zyi var1 = this.a.g();
            zaz var2 = var1.a();
            if (var2 != null) {
               CellArea var5 = var2.a();
               return CellsHelper.cellIndexToName(var5.StartRow, var5.StartColumn) + ":" + CellsHelper.cellIndexToName(var5.EndRow, var5.EndColumn);
            }

            zaaz var3 = var1.b();
            if (var3 != null) {
               CellArea var4 = var3.a;
               return CellsHelper.cellIndexToName(var4.StartRow, var4.StartColumn) + ":" + CellsHelper.cellIndexToName(var4.EndRow, var4.EndColumn);
            }
         }

         return null;
      }
   }

   public byte getFormulaType() {
      if (this.g == -1 && this.a != null && this.a.isFormula()) {
         if (this.a.isInArray()) {
            this.g = 1;
         } else if (this.a.z()) {
            this.g = 2;
         } else if (this.a.isInTable()) {
            this.g = 3;
         } else {
            this.g = 0;
         }
      }

      return this.g;
   }

   public LightCell copy() {
      LightCell var1 = new LightCell();
      var1.b = this.b;
      var1.c = (short)this.a.getColumn();
      var1.e = this.getValue();
      var1.d = this.getValueType();
      var1.f = this.getFormula();
      return var1;
   }
}
